﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace PlaneGame
{
    public class Tools : GameObject
    {

        public Tools(int x, int y) : base(x, y, Properties.Resources.prop_type_1)
        {
           
        }


        /// <summary>
        /// 道具移动的方法
        /// </summary>
        public void Move()
        {
            this.Y = this.Y + 2;
            //当飞机移动到屏幕外边的时候，应该让自己消失
            if (this.Y > 850)
            {
                //把自己移除掉
                DataUtil.toolList.Remove(this);
            }
        }


        //把自己画出来
        public void Draw(Graphics g)
        {
            this.Move();
            g.DrawImage(this.img, this.X, this.Y, this.Width, this.Height);
        }


        /// <summary>
        /// 获取游戏对象的矩形
        /// </summary>
        /// <returns>矩形</returns>
        public Rectangle getRectangle()
        {
            return new Rectangle(this.X, this.Y, this.Width, this.Height);
        }



        /// <summary>
        /// 是否得到道具
        /// </summary>
        /// <returns></returns>
        public bool IsGet()
        {
             System.Media.SoundPlayer sound = new System.Media.SoundPlayer(Properties.Resources.get_bomb);
             sound.Play();
             return true;
        }

    }
}
